import React, { Component } from 'react';
import { Pagination } from 'antd';
import styles from './index.less';

export default class Mpagination extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  render() {
    const { onShowSizeChange, handlePaginationChange } = this.props;
    return (
      <div className={styles.pagination}>
        <span>
          共{this.props.total}条记录&nbsp;&nbsp;每页
          {this.props.pageSize}条&nbsp;&nbsp;当前
          {this.props.current}/{this.props.total === 0 ? '1' : this.props.pages}
          页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          {this.props.model}
        </span>

        <Pagination
          // size={this.props.size}
          size="small"
          current={this.props.current * 1}
          total={(this.props.total === 0 ? '1' : this.props.total) * 1}
          showQuickJumper
          showSizeChanger
          onShowSizeChange={(current, size) => {
            onShowSizeChange(current, size);
          }}
          pageSizeOptions={['20', '50', '100', '200']}
          defaultPageSize={this.props.pageSize * 1}
          onChange={handlePaginationChange}
        />
      </div>
    );
  }
}
